package com.belarus.kamianiec.photo.photoSite.web;

import org.zkoss.bind.BindUtils;
import org.zkoss.bind.annotation.NotifyChange;

public class MainPageVm {

	private final static String mainMenuLabel = ConstantsMenu.MAIN;
	private final static String newsMenuLabel = ConstantsMenu.NEWS;
	private final static String galleryMenuLabel = ConstantsMenu.GALLERY;
	private final static String serviceMenuLabel = ConstantsMenu.SERVICE;
	private final static String contactsMenuLabel = ConstantsMenu.CONTACTS;

	private String innerSource = ConstantsMenu.MAIN_APP_SOURCE;
	private final static String innerSourceName = "innerSource";
	
	public MainPageVm() {
		// TODO initialize from DB
		// TODO multilanguage
	}

	/**
	 * @return the mainmenulabel
	 */
	public String getMainMenuLabel() {
		return mainMenuLabel;
	}

	/**
	 * @return the newsmenulabel
	 */
	public String getNewsMenuLabel() {
		return newsMenuLabel;
	}

	/**
	 * @return the gallerymenulabel
	 */
	public String getGalleryMenuLabel() {
		return galleryMenuLabel;
	}

	/**
	 * @return the contactsmenulabel
	 */
	public String getContactsMenuLabel() {
		return contactsMenuLabel;
	}

	/**
	 * @return the servicemenulabel
	 */
	public String getServiceMenuLabel() {
		return serviceMenuLabel;
	}

	/**
	 * @return the innerSource
	 */
	public String getInnerSource() {
		return innerSource;
	}

	/**
	 * @param innerSource
	 *            the innerSource to set
	 */
	@NotifyChange(innerSourceName)
	public void setInnerSource(String innerSource) {
		this.innerSource = innerSource;
		BindUtils.postNotifyChange(null, null, this, innerSourceName);
	}

	public void setInnerSource(EnumMenu menuItem) {
		switch (menuItem) {
		case CONTACTS:
			setInnerSource(ConstantsMenu.CONTACTS_APP_SOURCE);
			break;
		case GALLERY:
			setInnerSource(ConstantsMenu.GALLERY_APP_SOURCE);
			break;
		case MAIN:
			setInnerSource(ConstantsMenu.MAIN_APP_SOURCE);
			break;
		case NEWS:
			setInnerSource(ConstantsMenu.NEWS_APP_SOURCE);
			break;
		case SERVICE:
			setInnerSource(ConstantsMenu.SERVICE_APP_SOURCE);
			break;
		default:
			break;
		}
	}
}
